FILE(GLOB LUA_EXAMPLES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.lua)
LIST(REMOVE_ITEM LUA_EXAMPLES load.lua)

FOREACH(EXAMPLE ${LUA_EXAMPLES})
	STRING(REGEX REPLACE "(.*).lua" "\\1" EXAMPLE_NAME ${EXAMPLE})
	add_test(NAME lua-${EXAMPLE_NAME}
			WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
			COMMAND ${LUA_EXECUTABLE} ${EXAMPLE})
	set_property(TEST lua-${EXAMPLE_NAME} PROPERTY
		ENVIRONMENT "LUA_CPATH=${LUA_MODULAR_BUILD_DIR}/libmodshogun.so")
ENDFOREACH()